package com.tyc.flink.guigu.chapter05;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * 类描述
 *
 * @author tyc
 * @version 1.0
 * @date 2022-11-22 09:58:45
 */
public class TransKeyByTest {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        DataStreamSource<Event> streamSource = env.fromElements(
                new Event("mary", "/home", 1000L),
                new Event("Bob", "/user", 500L)
        );

        streamSource.keyBy(item -> item.user);

        env.execute();
    }
}
